<?php
//商品品牌处理模块
class GoodsBrandControl extends Control{
	//默认显示的首页
	public function index(){
		$brand=cache("brand");
		 $this->assign("data",$brand);
		$this->display();
	}
	//增加品牌
	public function add(){
		if(IS_POST){
                        $Model=K("GoodsBrand");
                        if($Model->addBrand()){
                        	$this->success("操作成功。。。",U("index"));
                        }else{
                        	$this->error($Model->error);
                        }
		}else{
                            $this->display();
		}
	}
         //编辑品牌
         public function edit(){
         	      if(IS_POST){
                     $Model=K("Goodsbrand");
                     if($Model->editBrand()){
                     	$this->success("操作成功 。。。",U("index"));
                     }else{
                     	$this->error($Model->error);
                     }
         	      }else{
         	      $bid=Q("bid",0,"intval");
         	      if($bid){
         	      	$data=M("Brand")->where(array("bid"=>$bid))->find();
         	      	$this->assign("data",$data);
         	      	$this->display();
         	         }
         	      }
         }
         //删除品牌
         public function del(){
               $bid=Q("bid",0,"intval");
               if($bid){
               	$Model=K("GoodsBrand");
               	if($Model->delBrand()){
                         $this->success("删除成功");
               	}else{
               		$this->error($Model->error);
               	}
               }else{
               	$this->errro("参数错误");
               }

         }





}